import pymysql

con = pymysql.connect(host="localhost",user="root",password="123456",database="spider")
# 获取游标
cursor = con.cursor()
# sql
sql = "update users set age=%s where name=%s"
# 执行sql
row = cursor.execute(sql,(50,"李四"))
print(row)
# 提交
con.commit()
# 关闭连接
cursor.close()
con.close()